package com.iplant.wms.serviceImpl.dao.brm;

import com.iplant.base.po.OutResult;
import com.iplant.base.po.Pagination;
import com.iplant.base.utils.annotation.dao.DBBaseDAO;
import com.iplant.base.utils.sql.BaseDAO;
import com.iplant.basic.service.po.bms.BMSEmployee;
import com.iplant.wms.service.po.brm.BRMReplenishRule;
import lombok.extern.slf4j.Slf4j;

import java.util.*;

@Slf4j
@DBBaseDAO(BRMReplenishRule.class)
public class BRMReplenishRuleDAO extends BaseDAO {

    private static BRMReplenishRuleDAO Instance = null;


    private BRMReplenishRuleDAO() {
        super("");
        this.Init();
    }

    public static BRMReplenishRuleDAO getInstance() {
        if (Instance == null) {
            Instance = new BRMReplenishRuleDAO();
        }
        return Instance;
    }


    public void BRM_DeleteReplenishRule(BMSEmployee wLoginUser, int wShelvesRuleID, OutResult<Integer> wErrorCode) {

        Map<String, Object> wDeleteParams = new HashMap<>();
        wDeleteParams.put("ShelvesRuleID", wShelvesRuleID);
        this.Delete(wDeleteParams, " and ID>0 ");
    }


    public List<BRMReplenishRule> BRM_QueryReplenishRuleList(
            BMSEmployee wLoginUser, String wName, int wStoreID,int wShelvesRuleID,
            int wActive, Pagination wPagination, OutResult<Integer> wErrorCode) {

        Map<String, Object> wParams = new HashMap<>();

        wParams.put("Name", wName);
        wParams.put("StoreID", wStoreID);
        wParams.put("ShelvesRuleID", wShelvesRuleID);
        wParams.put("Active", wActive);

        return this.SelectPOList(wLoginUser, wParams, wPagination, wErrorCode);
    }

}
